//
//  NSDataInfo.m
//  IPTV
//
//  Created by Echo on 13-11-20.
//  Copyright (c) 2013年 游强. All rights reserved.
//

#import "NSDataInfo.h"

@implementation NSDataInfo
@synthesize app_cmd, temp, isStudy, isAir, airType, array;
@synthesize isCustom, frame_x,frame_y,frame_w,frame_h, name, btnName, _id, type;
@synthesize str1, str2, str3;
- (id)init {
	if ((self = [super init])) {
        array = [[NSMutableArray alloc] init];
	}
	return self;
}
#pragma mark -
#pragma mark NSCoding Methods
- (void)encodeWithCoder:(NSCoder *)encoder {
	[encoder encodeObject:app_cmd forKey:@"app_cmd"];
    [encoder encodeObject:temp forKey:@"temp"];
    [encoder encodeObject:array forKey:@"array"];
    [encoder encodeBool:isStudy forKey:@"isStudy"];
    [encoder encodeBool:isAir forKey:@"isAir"];
    [encoder encodeInt:airType forKey:@"airType"];
    
    
    [encoder encodeInt:frame_x forKey:@"frame_x"];
    [encoder encodeInt:frame_y forKey:@"frame_y"];
    [encoder encodeInt:frame_w forKey:@"frame_w"];
    [encoder encodeInt:frame_h forKey:@"frame_h"];
    [encoder encodeInt:type forKey:@"type"];
    [encoder encodeBool:isCustom forKey:@"isCustom"];
    [encoder encodeObject:name forKey:@"name"];
    [encoder encodeObject:_id forKey:@"_id"];
    [encoder encodeObject:btnName forKey:@"btnName"];
    
    [encoder encodeObject:str1 forKey:@"str1"];
    [encoder encodeObject:str2 forKey:@"str2"];
    [encoder encodeObject:str3 forKey:@"str3"];
}

- (id)initWithCoder:(NSCoder *)decoder{
	self=[super init];
    self.app_cmd = [decoder decodeObjectForKey:@"app_cmd"];
    self.temp = [decoder decodeObjectForKey:@"temp"];
    self.array = [decoder decodeObjectForKey:@"array"];
    self.isStudy = [decoder decodeBoolForKey:@"isStudy"];
    self.isAir = [decoder decodeBoolForKey:@"isAir"];
    self.airType = [decoder decodeIntForKey:@"airType"];
    
    self.frame_x = [decoder decodeIntForKey:@"frame_x"];
    self.frame_y = [decoder decodeIntForKey:@"frame_y"];
    self.frame_w = [decoder decodeIntForKey:@"frame_w"];
    self.frame_h = [decoder decodeIntForKey:@"frame_h"];
    self.type = [decoder decodeIntForKey:@"type"];
    self.isCustom = [decoder decodeBoolForKey:@"isCustom"];
    
    self.name = [decoder decodeObjectForKey:@"name"];
    self.btnName = [decoder decodeObjectForKey:@"btnName"];
    self._id = [decoder decodeObjectForKey:@"_id"];
    
    self.str1 = [decoder decodeObjectForKey:@"str1"];
    self.str2 = [decoder decodeObjectForKey:@"str2"];
    self.str3 = [decoder decodeObjectForKey:str3];
	return self;
}
+(CGRect)nameToRect:(NSString*)name{
    CGRect rect = CGRectMake(0, 0, 50, 30);
    if ([name isEqualToString:@"custom_left"]) {
        rect = CGRectMake(0, 0, 45, 45);
    }else if ([name isEqualToString:@"custom_right"]) {
        rect = CGRectMake(0, 0, 45, 45);
    }else if ([name isEqualToString:@"custom_up"]) {
        rect = CGRectMake(0, 0, 45, 45);
    }else if ([name isEqualToString:@"custom_down"]) {
        rect = CGRectMake(0, 0, 45, 45);
    }
    
    else if ([name isEqualToString:@"custom_ok"]) {
        rect = CGRectMake(0, 0, 45, 45);
    }else if ([name isEqualToString:@"open"]) {
        rect = CGRectMake(0, 0, 50, 50);
    }else if ([name isEqualToString:@"custom_plus"]) {
        rect = CGRectMake(0, 0, 35, 57);
    }else if ([name isEqualToString:@"custom_reduce"]) {
        rect = CGRectMake(0, 0, 35, 57);
    }
    
    else if ([name isEqualToString:@"custom_volume_large"]) {
        rect = CGRectMake(0, 0, 60, 35);
    }else if ([name isEqualToString:@"custom_volume_small"]) {
        rect = CGRectMake(0, 0, 60, 35);
    }else if ([name isEqualToString:@"custom_button"]) {
        rect = CGRectMake(0, 0, 50, 50);
    }
    
    else if ([name isEqualToString:@"custom_off"]) {
        rect = CGRectMake(0, 0, 40, 40);
    }else if ([name isEqualToString:@"custom_on"]) {
        rect = CGRectMake(0, 0, 40, 40);
    }else if ([name isEqualToString:@"up_button"]) {
        rect = CGRectMake(0, 0, 40, 57);
    }else if ([name isEqualToString:@"down_button"]) {
        rect = CGRectMake(0, 0, 40, 57+5);
    }
    
    else if ([name isEqualToString:@"mute_button"]) {
        rect = CGRectMake(0, 0, 50, 50);
    }else if ([name isEqualToString:@"tv_home_button"]) {
        rect = CGRectMake(0, 0, 40, 40);
    }else if ([name isEqualToString:@"back_button"]) {
        rect = CGRectMake(0, 0, 40, 40);
    }else if ([name isEqualToString:@"AV_button"]) {
        rect = CGRectMake(0, 0, 40, 40);
    }
    
    return rect;
}
-(void)dealloc {
}
@end

@implementation DelayInfo
@synthesize app_cmd, time;
- (void)encodeWithCoder:(NSCoder *)encoder {
	[encoder encodeObject:app_cmd forKey:@"app_cmd"];
    [encoder encodeObject:time forKey:@"time"];
}

- (id)initWithCoder:(NSCoder *)decoder{
	self=[super init];
    self.app_cmd = [decoder decodeObjectForKey:@"app_cmd"];
    self.time = [decoder decodeObjectForKey:@"time"];
	return self;
}
@end










